package com.caiyi.financial.nirvana.sms.service;

import com.caiyi.financial.nirvana.sms.base.service.BaseService;
import com.caiyi.financial.nirvana.sms.entity.SmsBatchMsg;
import com.caiyi.financial.nirvana.sms.mapper.SmsBatchMsgMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SmsBatchMsgService extends BaseService<SmsBatchMsg> {

    @Autowired
    private SmsBatchMsgMapper smsBatchMsgMapper;

    @Transactional
    public void insertList(List<SmsBatchMsg> smsBatchMsg) {
        try {
            int res = smsBatchMsgMapper.insertList(smsBatchMsg);
            logger.info("BatchInsertMessageQueue insertList size : {} , insert into return {}", smsBatchMsg.size(), res);
            if (res != smsBatchMsg.size()) {
                logger.error("BatchInsertMessageQueue DB Insert Error.");
            }
        } catch (Exception e) {
            logger.error("SmsBatchMsgService smsBatchMsgMapper error  ", e);
        }
    }

}
